<%@ page pageEncoding="UTF-8"%>
<%@ include file="/common/token.jsp"%>
<%
	// 解绑第三方账户
	Integer id = token.getUid();
	String source = input.getDesc("source", "");
	String unionId = input.getDesc("union_id", "");
	if (!"weibo".equals(source) && !"qq".equals(source) && !"wechat".equals(source)) {
		Tools.encryptPrint(out, new Message(30041, "第三方来源不合法"));
		return;
	}
	if ("".equals(unionId)) {
		Tools.encryptPrint(out, new Message(30041, "第三方唯一标识不合法"));
		return;
	}
	List<UserAccount> list = QBuilder.db("basedb").select().from("UserAccount").where(new Where("hospital=", hospital).and("source=", source).and("unionId=", unionId).and("uid=", id).and("status=", STATUS_ENABLE)).query().getResultObj();
	if (list.size() == 0) {
		Tools.encryptPrint(out, new Message(30041, "未绑定过帐号"));
		return;
	}
	UserAccount userAccount = list.get(0);
	userAccount.setStatus(STATUS_DISABLE);
	DBTools.db("basedb").modItem(userAccount, userAccount.getId());
	Tools.encryptPrint(out, msg);
%>
